import { defineStore } from 'pinia'
import { ref } from 'vue'

// import { storage } from './storage.js'

export const useUserStore = defineStore(
  'user',
  () => {
    // 登录状态
    const token = ref('')
    // 更新登录状态
    const setToken = (newtoken) => {
      token.value = newtoken
    }
    return { token, setToken }
  },
  {
    persist: {
      paths: ['token'],
    },
  }
)
